<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>注册</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/X-admin/css/x-admin.css" media="all">
        <style type="text/css">
            *{
              padding:0;
              margin:0; 
            }
            body{
              background-color:#F3F3F3;
              /*display:block;*/
            }
            .main{
              margin:30px auto;
              width:600px;
              border:1px solid #ccc;
              box-shadow: 0px 0px 10px 5px #E4E4E4;
              border-radius:10px;
              background-color:white;
              z-index:999;
            }


        </style>
    </head>
    <body>
      <div class="layui-layout layui-layout-admin">
        <div class="layui-header header header-demo">
          <div class="layui-main">
              <a class="logo" href="__MODULE__/Index/index" >
                  <img src="__PUBLIC__/X-admin/images/logo.jpg" style="margin-bottom:10px;height:50px" >蜗牛小分队
              </a>
          </div>
        </div>

        <div class="x-nav">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
        </div>
      </div>
      <!-- 漂浮图片 -->
      <div class="body">
        <div></div>
	     
        <div class="main x-body">
			    	<form class="layui-form layui-form-pane" action="__MODULE__/Login/add" onsubmit="return demo()" method="post">
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:150px" >班级</label>
                <div class="layui-input-inline">
                  <select name="class" lay-verify="required">
                    <option value="">--请选择--</option>
                    <foreach name="class" item="row">
                      <option value="{$row['id']}">{$row['name']}</option>
                    </foreach>
                  </select>
                </div>
                <div class="layui-form-mid layui-word-aux"> * 请选择所在班级</div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">姓名</label>
                <div class="layui-input-inline">
                  <input type="text" id="name" name="name" required  lay-verify="required" placeholder="姓名" autocomplete="off" class="layui-input">
                </div>
                <div id="names" class="layui-form-mid layui-word-aux"> * 请填写真实姓名</div>
              </div>


              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">密码</label>
                <div class="layui-input-inline">
                  <input type="password" id="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
                <div id="passs" class="layui-form-mid layui-word-aux"> * 六至十八位的任意数字字母</div>
              </div>
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:150px">验证密码</label>
                <div class="layui-input-inline">
                  <input type="password" name="repassword" required lay-verify="required" placeholder="再次输入密码" autocomplete="off" class="layui-input">
                </div>
                <div id="repasss" class="layui-form-mid layui-word-aux"> * 验证密码</div>
              </div>
              
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">性别</label>
                <div class="layui-input-inline" >
                  <input type="radio" name="sex" value="1" title="男">
                  <input type="radio" name="sex" value="0" title="女" checked>
                </div>
                <!-- <div class="layui-form-mid layui-word-aux">辅助文字</div> -->
              </div>

              <div class="layui-form-item"  >
                <label class="layui-form-label" style="width:150px">身份证号码</label>
                <div class="layui-input-inline">
                  <input type="text" name="card" required  lay-verify="required" placeholder="身份证号码" autocomplete="off" class="layui-input">
                </div>
                <div id="cards" class="layui-form-mid layui-word-aux"> * 请填写真实身份证号</div>
              </div>

              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">籍贯</label>
                <div class="layui-input-inline">
                  <input type="text" name="address" placeholder="例:安徽省" class="layui-input">
                </div>
                <div id="addresss" class="layui-form-mid layui-word-aux"> * </div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">联系电话</label>
                <div class="layui-input-inline">
                  <input type="text" name="phone" required  lay-verify="phone" placeholder="电话" autocomplete="off" class="layui-input">
                </div>
                <div id="phones" class="layui-form-mid layui-word-aux"> * </div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">QQ</label>
                <div class="layui-input-inline">
                  <input type="text" name="QQ" class="layui-input">
                </div>
                <div id="qqs" class="layui-form-mid layui-word-aux"></div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">E-mail</label>
                <div class="layui-input-inline">
                  <input type="text" name="email" lay-verify="email" class="layui-input">
                </div>
                <div id="emails" class="layui-form-mid layui-word-aux"></div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">毕业院校所在省</label>
                <div class="layui-input-inline">
                  <input type="text" name="school_address" placeholder="例:安徽省" class="layui-input">
                </div>
              </div>
              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">毕业学校</label>
                <div class="layui-input-inline">
                  <input type="text" name="school" placeholder="例:南京大学" class="layui-input">
                </div>
              </div>

              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">学历</label>
                <div class="layui-input-inline">
                  <select name="education" lay-verify="required">
                    <option value="">--请选择--</option>
                    <option value="初中">初中</option>
                    <option value="高中">高中</option>
                    <option value="中专">中专</option>
                    <option value="大专">大专</option>
                    <option value="本科">本科</option>
                    <option value="本科以上">本科以上</option>
                  </select>
                </div>
              </div>
              
              <div class="layui-form-item">
                <label class="layui-form-label" style="width:150px">专业</label>
                <div class="layui-input-inline">
                  <input type="text" name="subject" placeholder="例:移动通信技术"  class="layui-input">
                </div>
              </div>

              <div class="layui-form-item"  >
                <label class="layui-form-label" style="width:150px">计算机基础</label>
                <div class="layui-input-inline">
                  <select name="computer" lay-verify="required">
                    <option value="">--请选择--</option>
                    <option value="0">零基础</option>
                    <option value="1">有一点点基础</option>
                    <option value="2">计算机操作还可以</option>
                    <option value="3">学过编程语言</option>
                    <option value="4">有PHP编程基础</option>
                    <option value="5">从事过PHP工作</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px">工作经验(年)</label>
                <div class="layui-input-inline">
                  <select name="work_year" lay-verify="required">
                    <option value="">--请选择--</option>
                    <option value="0">无</option>
                    <option value="1">一年左右</option>
                    <option value="2">一到两年</option>
                    <option value="3">两到三年</option>
                    <option value="4">三到五年</option>
                    <option value="5">五年以上</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label" style="width:150px">目标月薪(元)</label>
                <div class="layui-input-inline">
                  <select name="target" lay-verify="required">
                    <option value="">--请选择--</option>
                    <option value="1500">1000-2000</option>
                    <option value="2000">2000-2500</option>
                    <option value="2500">2500-3000</option>
                    <option value="3500">3000-4000</option>
                    <option value="4500">4000-5000</option>
                    <option value="5000">5000以上</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item">
                <label class="layui-form-label" style="width:150px" >紧急联系人姓名</label>
                <div class="layui-input-inline">
                  <input type="text" name="contacts_name" class="layui-input">
                </div>
                <div id="contacts_names" class="layui-form-mid layui-word-aux"></div>
                
              </div>

              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px" >与紧急联系人关系</label>
                <div class="layui-input-inline">
                  <select name="contacts_relation">
                    <option value="">--请选择--</option>
                    <option value="父母">父母</option>
                    <option value="姐姐">姐姐</option>
                    <option value="哥哥">哥哥</option>
                    <option value="爷爷奶奶">爷爷奶奶</option>
                  </select>
                </div>
              </div>

              <div class="layui-form-item" >
                <label class="layui-form-label" style="width:150px" >紧急联系人电话</label>
                <div class="layui-input-inline">
                  <input  type="text" name="contacts_phone" class="layui-input">
                </div>
                <div id="contacts_phones" class="layui-form-mid layui-word-aux"></div>
              </div>

              <div class="layui-form-item">
                <div class="layui-input-inline">
                  <button class="layui-btn" lay-submit lay-filter="formDemo">立即注册</button>
                  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
              </div>
            </form>
          </div>
			 </div>

       <div>
        <center>  <p>Copyright 易第优（北京）教育咨询股份有限公司 2006 - 2017 Edu Inc.</p><br>Powered by <a href="javascript:;" title="狂拽酷炫吊炸天的蜗牛四人组(朱则聪、李家伟、程传民、陶勇)">蜗牛小分队</a></center>
    </div>

        <script src="__PUBLIC__/X-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="__PUBLIC__/X-admin/js/x-layui.js" charset="utf-8"></script>
          


        <script>

            layui.use(['laydate','element','laypage','layer','form'], function(){
              $ = layui.jquery;//jquery
              layer = layui.layer;//弹出层
  				    var form = layui.form();

              //对输入的信息进行Ajax验证
              //姓名匹配
              name1 = false;
              pass1 = false;
              repass1 = false;
              card = false; 
              address1 = false;
              phone1 =false;
              qq1 = false;
              email1 = false;
              contacts_name1 = false;
              contacts_phone1 = false;
              //姓名匹配
              $("input[name='name']").blur(function(){
                name = $(this).val();
                if(name.match(/[\u4E00-\u9FA5\uF900-\uFA2D]{2,4}/)){
                    $("#names").text("通过");
                    $("#names").css('color',"#999");
                    name1 = true;
                }else{
                    $("#names").text("姓名匹配错误");
                    $("#names").css('color',"red");
                    name1 = false;
                }
              });

              //密码正则匹配
              $("#password").blur(function () {
                  pass = $(this).val();
                  
                if(pass.match(/^[\w]{6,18}$/)){
                    $("#passs").text("通过");
                     $("#passs").css('color',"#999");
                    pass1 = true;
                }else{
                    $("#passs").text("密码为六至十八位的任意数字字母");
                    $("#passs").css('color',"red");
                    pass1 = false;
                }
              });

              //验证密码匹配
              $("input[name='repassword']").blur(function(){
                  repass = $(this).val()
                  pass = $("input[name='password']").val();
                  if(repass!=pass){
                    $("#repasss").text("两次密码输入不一致");
                    $("#repasss").css('color',"red");
                    repass1 = true;
                  }else{
                    $("#repasss").text("通过");
                    $("#repasss").css('color',"#999");
                    repass1 = true;
                  }
              });

              //身份证号验证
              $("input[name='card']").blur(function(){
                  card = $(this).val();
                  if(card.match(/^\d{17}[0-9]|X$/)){

                      $.post("__MODULE__/Login/preg_card",{card:card},function(data){
                          if(data==0){
                              $("#cards").text("身份证号验证通过");
                              $("#cards").css('color',"#999");
                              card = true;
                          }else{
                            $("#cards").text("身份证号已存在");
                            $("#cards").css('color',"red");
                            card = false;
                          }
                      });

                  }else{
                    $("#cards").text("身份证号格式不正确");
                    $("#cards").css('color',"red");
                    card = false;
                  }
                  
              });

              //籍贯验证
              $("input[name='address']").blur(function(){
                  address = $(this).val();
                  if(address.match(/[\u4E00-\u9FA5\uF900-\uFA2D]{2,6}/)){
                      $("#addresss").text("通过");
                      $("#addresss").css('color',"#999");
                      address1 = true;

                  }else{
                      $("#addresss").text("格式不正确");
                      $("#addresss").css('color',"red");
                      address1 = false;
                  }
                  
              });

              //手机号码验证
              $("input[name='phone']").blur(function(){
                  phone = $(this).val();
                  if(phone.match(/^1[3|4|5|8][0-9]\d{8}$/)){

                      $.post("__MODULE__/Login/preg_phone",{phone:phone},function(data){
                          if(data==0){
                              $("#phones").text("验证通过");
                              $("#phones").css('color',"#999");
                              phone1 = true;
                          }else{
                            $("#phones").text("手机号码已存在");
                            $("#phones").css('color',"red");
                            phone1 = false;
                          }
                      });

                  }else{
                    $("#phones").text("手机号码格式不正确");
                    $("#phones").css('color',"red");
                    phone1 = false;
                  }
                  
              });

              //QQ号码验证
              $("input[name='QQ']").blur(function(){
                  QQ = $(this).val();
                  if(QQ.match(/[1-9][0-9]{4,11}/)){
                      $("#qqs").text("通过");
                      $("#qqs").css('color',"#999");
                      qq1 = true;

                  }else{
                      $("#qqs").text("格式不正确");
                      $("#qqs").css('color',"red");
                      qq1 = false;
                  }
                  
              });

              //email验证
              $("input[name='email']").blur(function(){
                  email = $(this).val();
                  if(email.match(/^[0-9a-z][_.0-9a-z-]{0,31}@([0-9a-z][0-9a-z-]{0,30}[0-9a-z]\.){1,4}[a-z]{2,4}$/)){
                      $("#emails").text("通过");
                      $("#emails").css('color',"#999");
                      email1 = true;

                  }else{
                      $("#emails").text("格式不正确");
                      $("#emails").css('color',"red");
                      email1 = false;
                  }
                  
              });
              
              //联系人姓名匹配
              $("input[name='contacts_name']").blur(function(){
                contacts_name = $(this).val();
                if(contacts_name.match(/[\u4E00-\u9FA5\uF900-\uFA2D]{2,4}/)){
                    $("#contacts_names").text("通过");
                    $("#contacts_names").css('color',"#999");
                    contacts_name1 = true;
                }else{
                    $("#contacts_names").text("姓名匹配错误");
                    $("#contacts_names").css('color',"red");
                    contacts_name1 = false;
                }
              });

              //手机号码验证
              $("input[name='contacts_phone']").blur(function(){
                  contacts_phone = $(this).val();
                  if(contacts_phone.match(/^1[3|4|5|8][0-9]\d{8}$/)){
                      $("#contacts_phones").text("验证通过");
                      $("#contacts_phones").css('color',"#999");
                      contacts_phone1 = true;
                  }else{
                    $("#contacts_phones").text("手机号码格式不正确");
                    $("#contacts_phones").css('color',"red");
                    contacts_phone1 = false;
                  }
                  
              });
              
            });
            function demo(){
              if(name1 & pass1 & repass1 & card & address1 & phone1 & qq1 & email1 & contacts_name1 & contacts_phone1){
                return true;
              }else{
                return false;
              }
            }
              
          </script>
   
    </body>
</html>